﻿import request from '@/utils/request'

// 发送书籍评论
export function sendComment(type, articleId, rootId, toCommentId, toCommentUserId, content) {
    return request({
        url: '/comment',
        method: 'post',
        headers: {
            isToken: true
        },
        data: { "articleId": articleId, "type": type, "rootId": rootId, "toCommentId": toCommentId, "toCommentUserId": toCommentUserId, "content": content }
    })
}

// 获取书籍评论
export function getBookComment(query) {
    return request({
        url: '/comment/commentList',
        method: 'get',
        headers: {
            isToken: true
        },
        params: query
    })
}

// 评论点赞
export function updateUpvoteState(userId,commentId) {
    return request({
        url: '/comment/updateUpvoteState',
        method: 'post',
        headers: {
            isToken: true
        },
        data: { "userId": userId, "commentId": commentId }
    })
}